<!DOCTYPE html>
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>修改密码</title>
</head>
<body>
<div th:replace="/layout/css :: #css"></div>

<div class="container-fluid" style="width: 400px;">
    <form id="modifyPassword" method="post" class="form-horizontal modal-form">
        <input id="id" name="id" th:type="hidden" />
        <div class="form-group">
            <label for="password" class="control-label">新密码</label>
            <input id="password" name="password" type="password" class="form-control" />
        </div>
        <br />
        <button type="button" class="btn btn-primary btn-block" onclick="doModify()">修 改</button>
    </form>
</div>

<script type="text/javascript" th:src="@{/js/modalPage.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/

    $(function () {
        var id = [[${id}]];
        $("#id").val(id);
    });

    function doModify(){
        $.ajax({
            type: 'post',
            url: '/user/doModifyPassword',
            data: $('#modifyPassword').serialize(),
            success: function(result) {
                if (result.status != 0) {
                    failHandler(result);
                } else {
                    successConfirm();
                    closeModalNotRefresh();
                }
            },
            error: errorHandler
        });
    }
    /*]]>*/
</script>
</body>
</html>